#include<bits/stdc++.h>
using namespace std;

const int N = 1e5 + 5;
int n,a[N];
int s[N],cnt;
int t[N],l,r = -1;
int ans;
int main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);

    scanf("%d",&n);
    for(int i = 1;i <= n;i++){
        scanf("%d",&a[i]);
    }
    sort(a + 1,a + n + 1);
    for(int i = 1;i <= n;i++){
        if(cnt <= 0){
            if(r >= l && a[i] > t[l]){
                ++l;t[++r] = a[i];++ans;
            }
            else{
                s[++cnt] = a[i];
            }
        }
        else{
            if(s[cnt] == a[i]){
                s[++cnt] = a[i];
            }
            else if(s[cnt] < a[i]){
                t[++r] = a[i];
                --cnt;++ans;
            }
            else{
                //Something must has been wrong here,but do not assert
                //WARNING: MAY NOT BE MEANNINGFUL
                t[++r] = a[i];
                --cnt;++ans;
                //.......
            }
        }
    }
    printf("%d\n",n - ans);
    return 0;
}
